/*    */ package com.cr.framework.config;
/*    */ 
/*    */ import com.google.code.kaptcha.text.impl.DefaultTextCreator;
/*    */ import java.security.SecureRandom;
/*    */ import java.util.Random;
/*    */ 
/*    */ public class KaptchaTextCreator extends DefaultTextCreator {
/* 14 */   private static final String[] CNUMBERS = "0,1,2,3,4,5,6,7,8,9,10".split(",");
/*    */   
/*    */   public String getText() {
/* 19 */     Integer result = Integer.valueOf(0);
/* 20 */     Random random = new SecureRandom();
/* 21 */     int x = random.nextInt(10);
/* 22 */     int y = random.nextInt(10);
/* 23 */     StringBuilder suChinese = new StringBuilder();
/* 24 */     int randomoperands = (int)Math.round(Math.random() * 2.0D);
/* 25 */     if (randomoperands == 0) {
/* 27 */       result = Integer.valueOf(x * y);
/* 28 */       suChinese.append(CNUMBERS[x]);
/* 29 */       suChinese.append("*");
/* 30 */       suChinese.append(CNUMBERS[y]);
/* 32 */     } else if (randomoperands == 1) {
/* 34 */       if (x != 0 && y % x == 0) {
/* 36 */         result = Integer.valueOf(y / x);
/* 37 */         suChinese.append(CNUMBERS[y]);
/* 38 */         suChinese.append("/");
/* 39 */         suChinese.append(CNUMBERS[x]);
/*    */       } else {
/* 43 */         result = Integer.valueOf(x + y);
/* 44 */         suChinese.append(CNUMBERS[x]);
/* 45 */         suChinese.append("+");
/* 46 */         suChinese.append(CNUMBERS[y]);
/*    */       } 
/* 49 */     } else if (randomoperands == 2) {
/* 51 */       if (x >= y) {
/* 53 */         result = Integer.valueOf(x - y);
/* 54 */         suChinese.append(CNUMBERS[x]);
/* 55 */         suChinese.append("-");
/* 56 */         suChinese.append(CNUMBERS[y]);
/*    */       } else {
/* 60 */         result = Integer.valueOf(y - x);
/* 61 */         suChinese.append(CNUMBERS[y]);
/* 62 */         suChinese.append("-");
/* 63 */         suChinese.append(CNUMBERS[x]);
/*    */       } 
/*    */     } else {
/* 68 */       result = Integer.valueOf(x + y);
/* 69 */       suChinese.append(CNUMBERS[x]);
/* 70 */       suChinese.append("+");
/* 71 */       suChinese.append(CNUMBERS[y]);
/*    */     } 
/* 73 */     suChinese.append("=?@" + result);
/* 74 */     return suChinese.toString();
/*    */   }
/*    */ }


/* Location:              D:\tmp\creditorRights-admin\BOOT-INF\lib\creditorRights-framework-4.7.0.jar!\com\cr\framework\config\KaptchaTextCreator.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */